export default {
  namespace: 'formManage',
  state: {
    isLeaf: false,
    treeData: [],
    selectCatalog: {},
    selectForm: {},
    catalogAddVisible: false,
    catalogAddType: '',
    catalogButton: false,
    formAddVisible: false,
    formAddType: '',
    formButton: false,
    addVersionNbr: null,
    formPreviewVisible: false, // 表单预览弹窗
    formDrawVisible: false, // 表单绘制页面
  },

  effects: {},

  reducers: {
    saveSelectCatalog(state, { payload: params }) {
      return {
        ...state,
        selectCatalog: params,
      };
    },
    saveSelectForm(state, { payload: params }) {
      return {
        ...state,
        selectForm: params,
      };
    },
    saveTreeData(state, { payload: params }) {
      return {
        ...state,
        treeData: params,
      };
    },
    saveIsLeaf(state, { payload: params }) {
      return {
        ...state,
        isLeaf: params,
      };
    },
    saveCatalogAddVisible(state, { payload: params }) {
      return {
        ...state,
        catalogAddVisible: params,
      };
    },
    saveCatalogAddType(state, { payload: params }) {
      return {
        ...state,
        catalogAddType: params,
      };
    },
    saveCatalogButton(state, { payload: params }) {
      return {
        ...state,
        catalogButton: params,
      };
    },
    saveFormAddVisible(state, { payload: params }) {
      return {
        ...state,
        formAddVisible: params,
      };
    },
    saveFormAddType(state, { payload: params }) {
      return {
        ...state,
        formAddType: params,
      };
    },
    saveFormButton(state, { payload: params }) {
      return {
        ...state,
        formButton: params,
      };
    },
    saveAddVersionNbr(state, { payload: params }) {
      return {
        ...state,
        addVersionNbr: params,
      };
    },
    saveFormPreviewVisible(state, { payload: params }) {
      return {
        ...state,
        formPreviewVisible: params,
      };
    },
    saveFormDrawVisible(state, { payload: params }) {
      return {
        ...state,
        formDrawVisible: params,
      };
    },
  },
};
